
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.shierke.Ume.ui.fragment.explore.ExploreFragment
import com.shierke.Ume.ui.fragment.match.MatchFragment
import com.shierke.Ume.ui.fragment.me.MeFragment
import com.shierke.Ume.ui.fragment.message.MessageFragment

class MainAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {

    val fragments: List<Fragment> = arrayListOf()

    init {
        if (fragments is ArrayList) {
            fragments.add(MatchFragment())
            fragments.add(ExploreFragment())
            fragments.add(MessageFragment())
            fragments.add(MeFragment())
        }
    }

    override fun getItem(position: Int): Fragment = fragments[position]

    override fun getCount(): Int = fragments.size
}